#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <math.h>

int main ()
{
	double fx = 0;
	double a,b,c,d,x;
	
	scanf("%lf %lf %lf %lf %lf",&x,&a,&b,&c,&d);
	fx = a*pow(x,3.0) + b*pow(x,2.0) + c*x + d;
	printf("%.7lf",fx);
	
	return 0; 
}


